<template>
  <div>
    <div class="overall-table-surround">
      <div class="overall-table-surround-options">
        <div class="overall-table-surround-options-left">
          <template v-if="userAddressList.length">
            <el-button size="mini" plain type="warning" icon="el-icon-refresh"
              >全选</el-button
            >
            <el-button size="mini" plain type="danger" icon="el-icon-refresh"
              >批量删除</el-button
            >
          </template>
        </div>
        <div class="overall-table-surround-options-right">
          <el-button
            size="mini"
            type="primary"
            icon="el-icon-plus"
            @click="clickAddAddress"
            >添加新地址</el-button
          >
        </div>
      </div>
    </div>
    <template v-if="userAddressList.length"> </template>
    <template v-else>
      <el-empty description="暂无记录"></el-empty>
    </template>
  </div>
</template>

<script>
import ManageAPI from "@/api/manage";
export default {
  created() {
    let { userid } = this.$route.query;
    this.userid = userid;
    this.getUserAddress();
  },
  data() {
    return {
      userid: null,
      userAddressList: [],
    };
  },
  methods: {
    clickAddAddress() {},
    getUserAddress() {
      ManageAPI.userAddressList({ user: this.userid })
        .then((res) => {
          let data = res.data;
          this.userAddressList = data;
        })
        .catch((err) => {
          this.$message({
            message: err.msg,
            type: "error",
          });
        });
    },
  },
};
</script>

<style></style>
